package com.witdata.controller.upload;

import com.witdata.common.domain.Result;
import com.witdata.common.service.ImageService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequiredArgsConstructor
@RequestMapping("/upload/image")
@Tag(name = "图片接口")
public class ImgController {

    private final ImageService imageService;

    @PostMapping("")
    public Result<String> uploadImage(@RequestParam("image") MultipartFile image, @RequestParam("url") String url, @RequestParam("name") String name) {
        imageService.uploadImage(image, url, name);
        return Result.ok();
    }

}
